﻿/*
 * Created by SharpDevelop.
 * User: IEscarro
 * Date: 9/10/2009
 * Time: 11:53 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using Buaya.Model;

namespace Buaya.Gui
{
	/// <summary>
	/// Description of PayrollCodeParameterForm.
	/// </summary>
	public partial class PayrollCodeParameterForm : Form
	{
		public PayrollCode PayrollCode {
			get {
				if (comboBoxPayrollCode.SelectedIndex >= 0) {
					return (comboBoxPayrollCode.DataSource as IList<PayrollCode>)[comboBoxPayrollCode.SelectedIndex];
				} else {
					return null;
				}
			}
		}
		
		public bool SelectAll {
			get { return checkBoxSelectAll.Checked; }
		}
		
		public PayrollCodeParameterForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			Util.SwfUtility.SetupComboBox(comboBoxPayrollCode, SessionFacade.FindAllPayrollCodes(), "Id", "Code");
			Util.SwfUtility.SetupComboBox(comboBoxEmployees, SessionFacade.FindAllEmployees(), "Id", "Name");
		}
		
		void ButtonOkClick(object sender, EventArgs e)
		{
			DialogResult = DialogResult.OK;
			Close();
		}
		
		void ButtonCancelClick(object sender, EventArgs e)
		{
			Close();
		}
	}
}
